package com.ch.demo1;

public class demo6 {
    public static void main(String[] args) {
        Singleton s1 = Singleton.getInstance();
        Singleton s2 = Singleton.getInstance();
        s1.countTest();
        s2.countTest();
    }
}
class Singleton {
    private Singleton() {
    }
    static int count = 10;
    public void countTest() {
        count--;
        System.out.println("剩余票数为:" + count);
    }
    public static Singleton getInstance() {
        return new Singleton();
    }
}
